<?php

namespace app\admin\model;

use think\Model;


class School extends Model
{

    

    

    // 表名
    protected $name = 'school';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'letter_text'
    ];
    

    
    public function getLetterList()
    {
        return ['A' => __('A'), 'B' => __('B'), 'C' => __('C'), 'D' => __('D'), 'E' => __('E'), 'F' => __('F'), 'G' => __('G'), 'H' => __('H'), 'I' => __('I'), 'J' => __('J'), 'K' => __('K'), 'L' => __('L'), 'M' => __('M'), 'N' => __('N'), 'O' => __('O'), 'P' => __('P'), 'Q' => __('Q'), 'R' => __('R'), 'S' => __('S'), 'T' => __('T'), 'U' => __('U'), 'V' => __('V'), 'W' => __('W'), 'X' => __('X'), 'Y' => __('Y'), 'Z' => __('Z')];
    }


    public function getLetterTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['letter']) ? $data['letter'] : '');
        $list = $this->getLetterList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
